home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / tests / eval.test < prev    next >
Text File  |  1992-11-06  |  2KB  |  59 lines

  1. # Commands covered:  eval
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright 1991 Regents of the University of California
  8. # Permission to use, copy, modify, and distribute this
  9. # software and its documentation for any purpose and without
  10. # fee is hereby granted, provided that this copyright notice
  11. # appears in all copies.  The University of California makes no
  12. # representations about the suitability of this software for any
  13. # purpose.  It is provided "as is" without express or implied
  14. # warranty.
  15. #
  16. # $Header: /sprite/src/lib/tcl/tests/RCS/eval.test,v 1.4 91/08/20 14:19:02 ouster Exp $ (Berkeley)
  17.  
  18. if {[string compare test [info procs test]] == 1} then {source defs}
  19.  
  20. test eval-1.1 {single argument} {
  21.     eval {format 22}
  22. } 22
  23. test eval-1.2 {multiple arguments} {
  24.     set a {$b}
  25.     set b xyzzy
  26.     eval format $a
  27. } xyzzy
  28. test eval-1.3 {single argument} {
  29.     eval concat a b c d e f g
  30. } {a b c d e f g}
  31.  
  32. test eval-2.1 {error: not enough arguments} {catch eval} 1
  33. test eval-2.2 {error: not enough arguments} {
  34.     catch eval msg
  35.     set msg
  36. } {wrong # args: should be "eval arg ?arg ...?"}
  37. test eval-2.3 {error in eval'ed command} {
  38.     catch {eval {error "test error"}}
  39. } 1
  40. test eval-2.4 {error in eval'ed command} {
  41.     catch {eval {error "test error"}} msg
  42.     set msg
  43. } {test error}
  44. test eval-2.5 {error in eval'ed command: setting errorInfo} {
  45.     catch {eval {
  46.     set a 1
  47.     error "test error"
  48.     }} msg
  49.     set errorInfo
  50. } "test error
  51.     while executing
  52. \"error \"test error\"\"
  53.     (\"eval\" body line 3)
  54.     invoked from within
  55. \"eval {
  56.     set a 1
  57.     error \"test error\"
  58.     }\""
  59.